home *** CD-ROM | disk | FTP | other *** search
/ Java Developer's Companion / Java Developer's Companion.iso / binaries / Windows / jsdk / src / sun / servlet / isapi / ISAPIInputStream.java < prev    next >
Encoding:
Java Source  |  1997-07-18  |  2.0 KB  |  79 lines

  1. /*
  2.  * @(#)ISAPIInputStream.java    1.5 97/05/11
  3.  * 
  4.  * Copyright (c) 1995-1997 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  * CopyrightVersion 1.0
  20.  */
  21.  
  22. package sun.servlet.isapi;
  23.  
  24. import java.io.InputStream;
  25. import java.io.IOException;
  26. import sun.servlet.http.HttpInputStream;
  27.  
  28. /**
  29.  * This class implements an input stream for reading ISAPI extension
  30.  * request data.
  31.  *
  32.  * @version    1.5, 05/11/97
  33.  * @author    David Connelly
  34.  * @author    Jongyoon Lee
  35.  */
  36. class ISAPIInputStream extends HttpInputStream {
  37.     /*
  38.      * The ECB (Extension Control Block) for this request.
  39.      */
  40.     private ISAPIConnection conn;
  41.  
  42.     /*
  43.      * Initializes the input stream with the ECB for this request.
  44.      */
  45.     public void init(ISAPIConnection conn) {
  46.     this.conn = conn;
  47.     next();
  48.     }
  49.  
  50.     /*
  51.      * Resets the input stream to an uninitialized state.
  52.      */
  53.     public void resets() {
  54.     conn = null;
  55.     }
  56.  
  57.     /**
  58.      * Returns the number of bytes that can be read without blocking.
  59.      * @return the number of available bytes
  60.      */
  61.     public int available() {
  62.     return Integer.MAX_VALUE;
  63.     }
  64.  
  65.     /**
  66.      * Fills input buffer with more data.
  67.      */
  68.     protected void fill() throws IOException {
  69.     int len = Math.min(buf.length, limit - total);
  70.     if (len > 0) {
  71.         len = (int) conn.getData(total, buf, 0, len);
  72.         if (len > 0) {
  73.         pos = 0;
  74.         count = len;
  75.         }
  76.     }
  77.     }
  78. }
  79.